/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.una.pol.ii.is2.domain.flota;

import java.io.Serializable;
import java.math.BigInteger;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "vehiculo_caracteristica")
@NamedQueries({@NamedQuery(name = "VehiculoCaracteristica.findAll", query = "SELECT v FROM VehiculoCaracteristica v"), @NamedQuery(name = "VehiculoCaracteristica.findByVecaCodVehiculo", query = "SELECT v FROM VehiculoCaracteristica v WHERE v.vehiculoCaracteristicaPK.vecaCodVehiculo = :vecaCodVehiculo"), @NamedQuery(name = "VehiculoCaracteristica.findByVecaCodCaracteristica", query = "SELECT v FROM VehiculoCaracteristica v WHERE v.vehiculoCaracteristicaPK.vecaCodCaracteristica = :vecaCodCaracteristica"), @NamedQuery(name = "VehiculoCaracteristica.findByVecaValorCadena", query = "SELECT v FROM VehiculoCaracteristica v WHERE v.vecaValorCadena = :vecaValorCadena"), @NamedQuery(name = "VehiculoCaracteristica.findByVecaValorNumero", query = "SELECT v FROM VehiculoCaracteristica v WHERE v.vecaValorNumero = :vecaValorNumero")})
public class VehiculoCaracteristica implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected VehiculoCaracteristicaPK vehiculoCaracteristicaPK;
    @Column(name = "veca_valor_cadena")
    private String vecaValorCadena;
    @Column(name = "veca_valor_numero")
    private BigInteger vecaValorNumero;
    @JoinColumn(name = "veca_cod_caracteristica", referencedColumnName = "cara_cod", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Caracteristica caracteristica;
    @JoinColumn(name = "veca_cod_vehiculo", referencedColumnName = "vehi_cod", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Vehiculo vehiculo;

    public VehiculoCaracteristica() {
    }

    public VehiculoCaracteristica(VehiculoCaracteristicaPK vehiculoCaracteristicaPK) {
        this.vehiculoCaracteristicaPK = vehiculoCaracteristicaPK;
    }

    public VehiculoCaracteristica(int vecaCodVehiculo, Integer vecaCodCaracteristica) {
        this.vehiculoCaracteristicaPK = new VehiculoCaracteristicaPK(vecaCodVehiculo, vecaCodCaracteristica);
    }

    public VehiculoCaracteristicaPK getVehiculoCaracteristicaPK() {
        return vehiculoCaracteristicaPK;
    }

    public void setVehiculoCaracteristicaPK(VehiculoCaracteristicaPK vehiculoCaracteristicaPK) {
        this.vehiculoCaracteristicaPK = vehiculoCaracteristicaPK;
    }

    public String getVecaValorCadena() {
        return vecaValorCadena;
    }

    public void setVecaValorCadena(String vecaValorCadena) {
        this.vecaValorCadena = vecaValorCadena;
    }

    public BigInteger getVecaValorNumero() {
        return vecaValorNumero;
    }

    public void setVecaValorNumero(BigInteger vecaValorNumero) {
        this.vecaValorNumero = vecaValorNumero;
    }

    public Caracteristica getCaracteristica() {
        return caracteristica;
    }

    public void setCaracteristica(Caracteristica caracteristica) {
        this.caracteristica = caracteristica;
    }

    public Vehiculo getVehiculo() {
        return vehiculo;
    }

    public void setVehiculo(Vehiculo vehiculo) {
        this.vehiculo = vehiculo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (vehiculoCaracteristicaPK != null ? vehiculoCaracteristicaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof VehiculoCaracteristica)) {
            return false;
        }
        VehiculoCaracteristica other = (VehiculoCaracteristica) object;
        if ((this.vehiculoCaracteristicaPK == null && other.vehiculoCaracteristicaPK != null) || (this.vehiculoCaracteristicaPK != null && !this.vehiculoCaracteristicaPK.equals(other.vehiculoCaracteristicaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.una.pol.ii.is2.dao.flota.VehiculoCaracteristica[vehiculoCaracteristicaPK=" + vehiculoCaracteristicaPK + "]";
    }

}
